<!--
 * @Description: 
 * @Autor: 商晓彬
 * @Date: 2021-08-11 11:31:57
 * @LastEditors: 商晓彬
 * @LastEditTime: 2021-11-05 11:26:32
-->
<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="add modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div style="width:800px!important;margin: 1.75rem auto;">
        <div class="modal-content">
            <form *ngIf="active" #bopForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="flag">审批</span>
                        <span *ngIf="!flag">审批查看</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')"
                        [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body" style="height: 630px!important;overflow: auto;">
                    <div class="p-formgroup-inline"
                    style="display: flex;">
                    <div class="flex">
                        <label style="margin-top: 5px;margin-right: 32px;">型号*</label>
                        <p-dropdown disabled (onChange)="getLotNo($event)" required name="model" #modelSelect="ngModel"
                            [options]="modelOption" [(ngModel)]="form.moduleId">
                            <ng-template let-select pTemplate="selectedItem">
                                <span
                                    style="vertical-align:middle; margin-left: .5em;width:175px;">{{select.label}}</span>
                            </ng-template>
                            <ng-template let-select pTemplate="select">
                                <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                    <div style="font-size:14px;float:right;margin-top:4px;width: 175px; ">
                                        {{select.label}}
                                    </div>
                                </div>
                            </ng-template>
                        </p-dropdown>
                        <validation-messages [formCtrl]="modelSelect"></validation-messages>
                    </div>
                    <div class="flex">
                        <label style="margin-top: 5px;margin-left: 150px;margin-right: 32px;">发次*</label>
                        <p-dropdown disabled (onChange)="onChange($event)" required name="lotNo" #lotNoSelect="ngModel"
                            [options]="lotNoOption" [(ngModel)]="form.sendTimeId">
                            <ng-template let-select pTemplate="selectedItem">
                                <span
                                    style="vertical-align:middle; margin-left: .5em;width:175px;">{{select.label}}</span>
                            </ng-template>
                            <ng-template let-select pTemplate="select">
                                <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                    <div style="font-size:14px;float:right;margin-top:4px;width: 175px; ">
                                        {{select.label}}
                                    </div>
                                </div>
                            </ng-template>
                        </p-dropdown>
                        <validation-messages [formCtrl]="lotNoSelect"></validation-messages>
                    </div>
                </div>
                    <div class="p-formgroup-inline" style="display: flex;margin-top: 20px;">
                        <div class="flex">
                            <label style="margin-top: 5px;margin-right: 32px;">芯级*</label>
                            <p-dropdown disabled (onChange)="getBt($event)" required name="changeType" #changeTypeSelect="ngModel"
                                [options]="xjOption" [(ngModel)]="form.xjId">
                                <ng-template let-select pTemplate="selectedItem">
                                    <span
                                        style="vertical-align:middle; margin-left: .5em;width:175px;">{{select.label}}</span>
                                </ng-template>
                                <ng-template let-select pTemplate="select">
                                    <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                        <div style="font-size:14px;float:right;margin-top:4px;width: 175px; ">
                                            {{select.label}}
                                        </div>
                                    </div>
                                </ng-template>
                            </p-dropdown>
                            <validation-messages [formCtrl]="changeTypeSelect"></validation-messages>
                        </div>
                        <div class="flex">
                            <label style="margin-top: 5px;margin-left: 150px;margin-right: 32px;">部套*</label>
                            <p-dropdown disabled required name="btId" #reasonSelect="ngModel"
                                [options]="btOption" [(ngModel)]="form.btId">
                                <ng-template let-select pTemplate="selectedItem">
                                    <span
                                        style="vertical-align:middle; margin-left: .5em;width:175px;">{{select.label}}</span>
                                </ng-template>
                                <ng-template let-select pTemplate="select">
                                    <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                        <div style="font-size:14px;float:right;margin-top:4px;width: 175px; ">
                                            {{select.label}}
                                        </div>
                                    </div>
                                </ng-template>
                            </p-dropdown>
                            <validation-messages [formCtrl]="reasonSelect"></validation-messages>
                        </div>
                    </div>
                    <div class="p-formgroup-inline" style="margin-top: 20px;display: flex;">
                        <div class="flex">
                            <label style="margin-top: 5px;margin-right: 12px;">变更原因</label>
                            <p-dropdown disabled name="reason" #reasonSelect="ngModel"
                                [options]="reasonOption" [(ngModel)]="form.reasonsChange">
                                <ng-template let-select pTemplate="selectedItem">
                                    <span
                                        style="vertical-align:middle; margin-left: .5em;width:175px;">{{select.label}}</span>
                                </ng-template>
                                <ng-template let-select pTemplate="select">
                                    <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                        <div style="font-size:14px;float:right;margin-top:4px;width: 175px; ">
                                            {{select.label}}
                                        </div>
                                    </div>
                                </ng-template>
                            </p-dropdown>
                        </div>
                        <div class="flex">
                            <label style="margin-top: 5px;margin-left: 150px;margin-right: 40px;">版本</label>
                            <input disabled style=" width:200px;height: 35px;" id="rulesName" name="rulesName" type="text" [(ngModel)]="form.beforeVersion" />
                        </div>
                    </div>
                      
                      <div class="p-formgroup-inline" style="margin-top: 20px;">
                        <label style="margin-top: 5px;">变更原因说明：</label>
                        <textarea disabled name="opinion" rows="2" cols="100" pInputTextarea [(ngModel)]="form.reasonsChangeExplain"></textarea>
                      </div>
                      <div class="p-formgroup-inline" style="margin-top: 20px;display: flex;">
                        <!-- <div class="flex">
                            <label style="margin-top: 5px;margin-right: 20px;">编码规则*</label>
                            <p-dropdown disabled required name="codeFormatId" #codeFormatIdSelect="ngModel"
                                [options]="changeNoOption" [(ngModel)]="codeFormatId">
                                <ng-template let-select pTemplate="selectedItem">
                                    <span
                                        style="vertical-align:middle; margin-left: .5em;width:175px;">{{select.label}}</span>
                                </ng-template>
                                <ng-template let-select pTemplate="select">
                                    <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                        <div style="font-size:14px;float:right;margin-top:4px;width: 175px; ">
                                            {{select.label}}
                                        </div>
                                    </div>
                                </ng-template>
                            </p-dropdown>
                            <validation-messages [formCtrl]="codeFormatIdSelect"></validation-messages>
                        </div> -->
                        <div class="flex">
                            <label style="margin-top: 5px;">变更维护*</label>
                            <button style="margin-left: 20px;" pButton type="button" (click)="toMaintain()" label="维护查看" class="ui-button-raised"></button>
                        </div>
                  </div>
                      <div class="p-formgroup-inline" style="margin-top: 20px;">
                        <label style="margin-top: 5px;">变更内容：</label>
                        <textarea disabled name="content" rows="2" cols="100" pInputTextarea [(ngModel)]="form.changeContent"></textarea>
                      </div>
                </div>
                <div class="modal-footer" style="flex-wrap: wrap;" *ngIf="flag">
                    <div class="p-formgroup-inline">
                        <div >
                            <label style="margin-top: 5px;">审批意见：</label>
                            <textarea name="approvalRemark" rows="2" cols="100" pInputTextarea
                            [(ngModel)]="approvalForm.remark"></textarea>
                        </div>
                    </div>
                    <div class="p-formgroup-inline" style="width: 100%;
                    display: flex;
                    justify-content: center;
                    margin-top: 10px">
                        <button pButton class="ui-button-danger" type="button" label="拒绝" (click)="confues()"
                        style="margin-left: 0.5rem"></button>
                    <button pButton type="button" label="同意"
                        (click)="accept()" style="margin-left: 0.5rem"></button>
                    </div>
                </div>
                <div class="modal-footer" style="flex-flow: row wrap;
                justify-content: center;
                align-items: center;" *ngIf="!flag">
                    <div class="p-formgroup-inline " [ngClass]="getClass(item)" *ngFor="let item of approvalList">
                        <div *ngIf="item.result == 1"><i class="pi pi-check-circle" style="font-size: 3em"></i></div>
                        <div *ngIf="item.result == 2"><i class="pi pi-times" style="font-size: 3em"></i></div>
                        <div>{{item.getAffairRoles}}</div>
                        <div>{{item.userName}}，{{item.auditTime | momentFormat:'YYYY-MM-DD HH:mm:ss'}}</div>
                        <div>审批意见：{{item.remark}}</div>
                    </div>  
                </div>
            </form>
              <!-- 变更维护 -->
              <app-bom-watch #BomWatchComponent [editData]="form" [title]="maintTitle"></app-bom-watch>
        </div>
    </div>
</div>